package com.cirkana.viewer.route.gpx;

import java.util.List;

public class Tracker {

	private String fileName;
	private Metadata metadata;
	private List<WayPoint> wayPoints;
	private List<Track> tracks;

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public void setMetadata(Metadata metadata) {
		this.metadata = metadata;
	}

	public Metadata getMetadata() {
		return metadata;
	}

	public List<WayPoint> getWayPoints() {
		return this.wayPoints;
	}

	public void setWayPoints(List<WayPoint> wayPoints) {
		this.wayPoints = wayPoints;
	}

	public List<Track> getTracks() {
		return tracks;
	}

	public void setTracks(List<Track> tracks) {
		this.tracks = tracks;
	}

//	public void readFromParcel(Parcel source) {
//		this.fileName = source.readString();
//
//		this.metadata = new Metadata();
//		this.metadata.setName(source.readString());
//		this.metadata.setDesc(source.readString());
//		this.metadata.setAuthor(source.readString());
//
//		int wayPointsCount = source.readInt();
//		this.wayPoints = new ArrayList<WayPoint>();
//		for (int iii = 0; iii < wayPointsCount; iii++) {
//			WayPoint wayPoint = new WayPoint();
//			wayPoint.setName(source.readString());
//			wayPoint.setDesc(source.readString());
//			wayPoint.setCmt(source.readString());
//			wayPoint.setLat(source.readDouble());
//			wayPoint.setLon(source.readDouble());
//			wayPoint.setEle(source.readDouble());
//			wayPoint.setTime(new Date(source.readLong()));
//			this.wayPoints.add(wayPoint);
//		}
//
//		int tracksCount = source.readInt();
//		this.tracks = new ArrayList<Track>();
//		for (int iii = 0; iii < tracksCount; iii++) {
//			Track track = new Track();
//			track.setName(source.readString());
//			track.setDesc(source.readString());
//			track.setCmt(source.readString());
//
//			int trackPointsCount = source.readInt();
//			List<TrackPoint> trackPoints = new ArrayList<TrackPoint>();
//			for (int jjj = 0; jjj < trackPointsCount; jjj++) {
//				TrackPoint trackPoint = new TrackPoint();
//				trackPoint.setLat(source.readDouble());
//				trackPoint.setLon(source.readDouble());
//				trackPoint.setEle(source.readDouble());
//				trackPoint.setTime(new Date(source.readLong()));
//				trackPoints.add(trackPoint);
//			}
//			track.setTrackPoints(trackPoints);
//
//			this.tracks.add(track);
//		}
//
//	}
//
//	public void writeToParcel(Parcel dest) {
//		dest.writeString(this.fileName);
//
//		if (this.metadata == null)
//			this.metadata = new Metadata();
//		dest.writeString(this.metadata.getName());
//		dest.writeString(this.metadata.getDesc());
//		dest.writeString(this.metadata.getAuthor());
//
//		if (this.wayPoints == null)
//			dest.writeInt(0);
//		else {
//			for (int iii = 0; iii < this.wayPoints.size(); iii++) {
//				WayPoint wayPoint = this.wayPoints.get(iii);
//				dest.writeString(wayPoint.getName());
//				dest.writeString(wayPoint.getDesc());
//				dest.writeString(wayPoint.getCmt());
//				dest.writeDouble(wayPoint.getLat());
//				dest.writeDouble(wayPoint.getLon());
//				dest.writeDouble(wayPoint.getEle());
//				dest.writeLong(wayPoint.getTime().getTime());
//			}
//		}
//
//		if (this.tracks == null)
//			dest.writeInt(0);
//		else {
//			for (int iii = 0; iii < this.tracks.size(); iii++) {
//				Track track = this.tracks.get(iii);
//				dest.writeString(track.getName());
//				dest.writeString(track.getDesc());
//				dest.writeString(track.getCmt());
//
//				List<TrackPoint> trackPoints = track.getTrackPoints();
//				if (trackPoints == null)
//					dest.writeInt(0);
//				else {
//					for (int jjj = 0; jjj < trackPoints.size(); jjj++) {
//						TrackPoint trackPoint = trackPoints.get(jjj);
//						dest.writeDouble(trackPoint.getLat());
//						dest.writeDouble(trackPoint.getLon());
//						dest.writeDouble(trackPoint.getEle());
//						dest.writeLong(trackPoint.getTime().getTime());
//					}
//				}
//			}
//		}
//
//	}

	@Override
	public String toString() {
		StringBuilder s = new StringBuilder();
		s.append("tracker={fileName=" + fileName);
		s.append("," + metadata.toString());
		for (int iii = 0; iii < this.wayPoints.size(); iii++)
			s.append("," + this.wayPoints.get(iii).toString());
		for (int iii = 0; iii < this.tracks.size(); iii++)
			s.append("," + this.tracks.get(iii).toString());
		s.append("}");
		return s.toString();
	}
}
